package com.ny.zuoye2567.dao.service;

import com.ny.zuoye2567.dao.shiti.Product;
import com.ny.zuoye2567.dao.dao.ProductDao;
import com.ny.zuoye2567.dao.dao.ProductDaoImpl;

import java.sql.SQLException;
import java.util.List;

public class ProductServiceImpl implements ProductService{
    private ProductDao productDao = new ProductDaoImpl();
    public List<Product> findAllProduct() throws SQLException,ClassNotFoundException
    {
    	return productDao.findAllProduct();
    }

    @Override
    public int insertProduct(Product newProduct) {
        return  productDao.insertProduct(newProduct);
    }

    @Override
    public int deleteProduct(String delName) {
        return productDao.deleteProduct(delName);
    }

    @Override
    public Product findByName(String oldName) {
        return productDao.findByName(oldName);
    }

    @Override
    public int updateProduct(Product productToUpdate) {
        return productDao.updateProduct(productToUpdate);
    }


}
